//
// Created by Eric on 2022/11/5.
// 这个类只负责持有AsObject的数据
//



#ifndef UUU_ASOBJECT_H
#define UUU_ASOBJECT_H
#include <random>
#include "uuu_utility.h"

class AsObject {
public:
    // api
    void Display(){
        cout <<  "name: " << name_<<endl;
        cout <<"resource: "<<resource_<<endl;
        cout <<"cz_idx: " <<cz_idx_ <<endl;
        cout << "coord: " << coord_ <<endl;
    }

public:
    // 构造方法
    static AsObject CreateAsObject(string name,int resource, Coord coord, int cz_idx);
    AsObject();

public:
    // getter & setter
    [[nodiscard]]int energy() const{return this->resource_;}
    [[nodiscard]]auto coord() const{return this->coord_;}

private:
    // data
    string name_; // 星球名字
    int resource_; // 该星球拥有的资源总量
    int cz_idx_; // 属于星球的索引
    Coord coord_; // 星球的坐标
};

AsObject AsObject::CreateAsObject(string name, int resource, Coord coord, int cz_idx) {
    AsObject product;
    product.name_ = std::move(name);
    product.resource_ = resource;
    product.cz_idx_ = cz_idx;
    product.coord_ = coord;

    return product;
}

AsObject::AsObject(){
    resource_ = 0;
    coord_ = Coord(0, 0 ,0);
    cz_idx_ = -1;
}
#endif //UUU_ASOBJECT_H
